﻿@model Olemas.ViewModels.AddViewModel
@{
    ViewBag.Title = "Lisa materjal";
    ViewBag.CurrentPage = "addPage";
}

<h3>Mida soovid lisada?</h3>
<select id="selectCategory">
    <option value="1">õpik</option>
    <option value="2">konspekt</option>
    <option value="3">test</option>
</select>
<hr />
<p><b>Kuulutuse info:</b></p>
<div id="partialPlaceHolder">
    @Html.Partial("_AddBook")
</div>

@section AddToFooter{
    <script type="text/javascript">
        $('#selectCategory').change(function () {

            /* Get the selected value of dropdownlist */
            var selectedId = $(this).val();

            /* Request the partial view with .get request. */
            $.get('/Add/LoadAddPartial/' + selectedId, function (data) {

                /* data is the pure html returned from action method, load it to your page */
                $('#partialPlaceHolder').fadeOut('fast');
                $('#partialPlaceHolder').html(data);
                $('#partialPlaceHolder').fadeIn('fast');
            });
        });
        
    </script>
}
